package com.ooqiu.gaming.ui.splash;

import android.support.v7.widget.Toolbar;
import android.view.View;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.ooqiu.gaming.R;
import com.ooqiu.gaming.base.BaseActivity;
import com.ooqiu.gaming.ui.main.MainActivity;

import java.util.concurrent.TimeUnit;

import io.reactivex.Flowable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.subscribers.DefaultSubscriber;

@Route(path = SplashActivity.PATH)
public class SplashActivity extends BaseActivity {
    public static final String PATH = "/gn/splash";

    @Override
    public int initContentView() {
        return R.layout.activity_splash;
    }

    @Override
    public void initInjector() {

    }

    @Override
    public void initUiAndListener() {
            Flowable.just("")
                    .delay(2, TimeUnit.SECONDS)
                    .subscribeOn(Schedulers.io())
                    .observeOn(AndroidSchedulers.mainThread())
                    .subscribe(new DefaultSubscriber<String>() {
                        @Override
                        public void onNext(String s) {
                            ARouter.getInstance().build(MainActivity.PATH).navigation();
                            finish();
                        }

                        @Override
                        public void onError(Throwable t) {
                            t.printStackTrace();
                        }

                        @Override
                        public void onComplete() {

                        }
                    });

    }

    @Override
    protected Toolbar toolbarIdRes() {
        return null;
    }

    @Override
    protected View statusLayoutId() {
        return null;
    }

    @Override
    protected boolean isApplyStatusBarTranslucency() {
        return true;
    }

    @Override
    protected boolean isApplyStatusBarColor() {
        return false;
    }





}
